public class Test1 {
    //leetcode 300 最长递增子序列
    public int lengthOfLIS(int[] nums) {
        //dp表表示以第i个位置为结尾的所有子序列中最长递增子序列的长度
        int n = nums.length;
        int[] dp = new int[n];
        for (int i = 0; i < n; i++) dp[i] = 1;
        int ret = 1;
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                if (nums[j] < nums[i]) {
                    dp[i] = Math.max(dp[j] + 1,dp[i]);
                    ret = Math.max(ret,dp[i]);
                }
            }
        }
        return ret;
    }
}
